//Used to test BPM

package mycode;

import org.netbeans.jemmy.*;
import org.netbeans.jemmy.operators.*;

public class WaitDialogSample implements Scenario {
    @Override
	public int runIt(Object param) {
	try {
	    //start application
	    new ClassReference("org.netbeans.jemmy.explorer.GUIBrowser").startApplication();
	    //wait frame
	    JFrameOperator mainFrame = new JFrameOperator("GUI Browser");
	    new JButtonOperator(mainFrame, "Reload in ...").push();
	    new JButtonOperator(mainFrame, "Dump").push();
	    JDialogOperator dialog = new JDialogOperator(mainFrame, "保存");
	    JTextFieldOperator testField = new JTextFieldOperator(dialog);

	    //type new value in the text field
	    testField.clearText();
	    testField.typeText("test");
	    Thread.sleep(10000);
	    new JButtonOperator(dialog, "保存").push();
	    
//	    //push menu
//	    //pushMenuNoBlock is used, because dialog is modal
//	    //see tutorial for more information
//	    new JMenuBarOperator(mainFrame).pushMenuNoBlock("Tools|Properties", "|");
//	    //wait dialog
//	    new JDialogOperator(mainFrame, "Properties");
	    Thread.sleep(100000);
	} catch(Exception e) {
	    e.printStackTrace();
	    return(1);
	}
	return(0);
    }
    public static void main(String[] argv) {
	String[] params = {"mycode.WaitDialogSample"};
	org.netbeans.jemmy.Test.main(params);
    }
}

